//
//  YTHomeArticleCell.m
//  yitaicaijing
//
//  Created by DIANGHONG on 2018/7/10.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "YTHomeArticleCell.h"

@interface YTHomeArticleCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImage;
@property (weak, nonatomic) IBOutlet UILabel *authorLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *lookLabel;
@property (weak, nonatomic) IBOutlet UIImageView *avatorImageView;
@property (weak, nonatomic) IBOutlet UIImageView *tipTopImageView;

@end
@implementation YTHomeArticleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
        
    if (iPhone5)
    {
        self.titleLabel.font = [UIFont systemFontOfSize:13];
        self.authorLabel.font = [UIFont systemFontOfSize:9];
        self.timeLabel.font = [UIFont systemFontOfSize:9];
        self.lookLabel.font = [UIFont systemFontOfSize:9];
    }
    

}




- (void)setArticle:(YTHomeArticle *)article
{
    _article = article;
        
        
    self.titleLabel.attributedText = article.attrTitle;

    [self.avatorImageView sd_setImageWithURL:[NSURL URLWithString:article.user_avatar] placeholderImage:[UIImage imageNamed:@"icon_wode_dianji"]];
    self.tipTopImageView.hidden = !article.menu_order.boolValue;
    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:article.purl] placeholderImage:[UIImage imageNamed:@"9491537498435_.pic_hd"]];
    self.authorLabel.text = article.display_name;
    self.lookLabel.text = article.views;
    self.timeLabel.text = article.postDate;
    
    // 适配iPhone4尺寸
    self.timeLabel.hidden = IsIphone4S;
}


- (void)setSearchModel:(YTSearchArticleModel *)searchModel
{
    _searchModel = searchModel;

    self.titleLabel.text = searchModel.post_title;
    self.authorLabel.text = searchModel.display_name;
    searchModel.isArticle ? [self.iconImage sd_setImageWithURL:[NSURL URLWithString:searchModel.purl]] : [self.iconImage setImage:[UIImage imageNamed:@"kuaixun_placeHolder"]];
    self.lookLabel.text = searchModel.views;
    [self.avatorImageView sd_setImageWithURL:[NSURL URLWithString:searchModel.user_avatar]];
    self.timeLabel.text = searchModel.post_date;
}
    @end
